package com.sl.cdc.modular.debezium;

import io.debezium.engine.DebeziumEngine;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class CdcDebeziumCompletionCallback implements DebeziumEngine.CompletionCallback {
    private String taskId;

    public CdcDebeziumCompletionCallback(String taskId) {
        this.taskId = taskId;
    }


    @Override
    public void handle(boolean success, String message, Throwable error) {
        log.info("success:{},message:{},error:{}", success, message, error);

        if (!success) {
            log.error("Debezium【{}】 error:{}", taskId, message);
            log.error("Debezium error info:", error);
            return;
        }
        log.info("Debezium【{}】 completionCallback!", taskId);
    }
}
